package com.example.baserecyclerviewadapterhelperdemo.adapter;

import android.widget.ImageView;

import androidx.annotation.Nullable;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.example.baserecyclerviewadapterhelperdemo.R;
import com.example.baserecyclerviewadapterhelperdemo.po.Model;

import java.util.List;

public class MyAdapter extends BaseQuickAdapter<Model, BaseViewHolder> {
    public MyAdapter(int layoutResId, @Nullable List<Model> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, Model item) {
        helper.setText(R.id.tv_title,item.getTitle())
                .setText(R.id.tv_content,item.getContent());
        // 设置图片
        Glide.with(mContext).load(item.getImgUrl()).into((ImageView) helper.getView(R.id.iv_img));

    }
}
